package cn.huaguo.domain.campus.service;

import cn.huaguo.domain.campus.model.entity.CampusEntity;
import cn.huaguo.domain.campus.model.valobj.CampusVO;
import cn.huaguo.domain.campus.repository.ICampusRepository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description 校区Service实现类
 * @Author wangQian
 * @Date 2024/5/15
 */
@Service
public class CampusService implements ICampusService {
    @Resource
    private ICampusRepository campusRepository;

    /**
     * 新增校区
     *
     * @param campusVO
     */
    @Override
    public void addCampus(CampusVO campusVO) {
        campusRepository.addCampus(campusVO);
    }

    /**
     * 获取所有校区信息
     *
     * @return
     */
    @Override
    public List<CampusEntity> listAllCampus() {
        return campusRepository.listAllCampus();
    }

    /**
     * 根据id获取校区信息
     *
     * @param id
     * @return
     */
    @Override
    public CampusEntity getCampusById(Integer id) {
        return campusRepository.getCampusById(id);
    }

    /**
     * 根据id更新校区信息
     *
     * @param campusEntity
     * @return
     */
    @Override
    public Boolean updateCampus(CampusEntity campusEntity) {
        return campusRepository.updateCampus(campusEntity);
    }

    /**
     * 根据id删除校区信息
     *
     * @param id
     */
    @Override
    public void deleteCampus(Integer id) {
        campusRepository.deleteCampus(id);
    }
}
